<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- 下级管理新页面 -->
<style>
.content .main-content {
    width: 1000px;
    margin-left: 20px;
    margin-bottom: 10px;
    padding-left: 10px;
    border:none;
}
.w90 {
    width: 90px!important;
}

.accountTable .ty_table3 tr th{
    text-align: center;
    font-weight: normal;
}

.searchPart span{
	margin-right: 40px;
}
.searchPart .reset{
	display: inline-block;
    line-height: 30px;
    color: #fff !important;
    height: 30px;
    padding: 0 15px;
    border-radius: 3px;
    font-size: 14px;
    min-width: 55px;
    text-align: center;
    cursor: pointer;
    background: #2e4158;
    margin: 10px;
    
}

 .btn-default {
    color: #333 !important;
    background-color: #fff !important;
    border-color: #ccc;
}

.searchPart a{
	font-weight: 500;
} 

#subuser{
	border:none;
}

</style>
<section data-v-c2f0218a="" class="main-content subManageNew view">
		<div data-v-ab88e076="" class="userTitle mgb10">
		下级管理
	</div>
	<div data-v-ab88e076="" class="userMain mgb10 agMembers">
		<div data-v-ab88e076="" class="searchPart">
		 	<span>我的下级</span>&nbsp;
			账号：
			<input data-v-ab88e076="" type="text" name="a" class="userInput w90"> &nbsp;
			<a data-v-ab88e076="" class="submitBtn">搜索</a>
			<a data-v-ab88e076="" class="reset">重置</a>
		</div>
		<div data-v-ab88e076="" class="accountTable">
			<table data-v-ab88e076="" width="100%" border="0" cellspacing="0" cellpadding="0" class="ty_table3 table" id="subUser">
				<thead data-v-ab88e076="">
					<tr data-v-ab88e076="">
						<th data-v-ab88e076="">账号</th>
						<th data-v-ab88e076="">用户类型</th>
						<th data-v-ab88e076="">返点率</th>
						<th data-v-ab88e076="">余额</th>
						<th data-v-ab88e076="">注册时间</th>
						<th data-v-ab88e076="">最后登录</th>
						<th data-v-ab88e076="">操作</th> 
					</tr>
				</thead>
				<tbody data-v-ab88e076="">
					<!-- <tr data-v-ab88e076="" style="border-bottom: 0px;">
						<td data-v-ab88e076="" colspan="100">
							<div data-v-ab88e076="" class="notContent" style="padding: 100px 0px;"><i data-v-ab88e076="" class="defFont"></i>暂无记录</div>
						</td>
					</tr> -->
				</tbody>
			</table>
			<!-- <div data-v-ab88e076="" class="page">
				<p data-v-ab88e076="">共<em data-v-ab88e076="">0</em>条记录</p>
				<div data-v-ab88e076="" id="pageNav" class="pageNav">
					<div data-v-ab88e076="" id="pageNav" class="pageNav">
						<ul class="pagination" style="display: none;">
							<li style="display: none;">
								<a>上一页</a>
							</li>
							<li style="display: none;">
								<a>下一页</a>
							</li>
						</ul>
					</div>
				</div>
			</div> -->
		</div>
	</div>
</section>
<script type="text/javascript">
var userName="";
var datatable;
function datatable01(){
	datatable=$("#subUser").DataTable({
	    "bLengthChange": true,      
	    "bSort": false,
	    "bAutoWidth": false,
	    'aLengthMenu':[10],
	     "searching": false,
	     "dom": `ftp`,
	     "language": {
	          "lengthMenu": "每页显示 _MENU_ 条记录",     
	          "zeroRecords": "没有检索到数据",     
	          "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
	          "info": "没有数据",     
	          "oPaginate": {     
	              "sFirst": "首页",     
	              "sPrevious": "前一页",     
	              "sNext": "后一页",     
	              "sLast": "尾页"    
	        	},
	          "search":"搜索:",
	          "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
	          "infoEmpty":      "没有找到匹配的信息",
	       },
	       "ajax": {
	      	 "type": "POST",
	      	 "url":"/agencyCenter/subordinate.do",
	      	"data": function ( d ) {
		        d.name =$(".userInput").val();
		        d.cname=userName;
		    },
	      	 "dataSrc": function(json) {
	      		 var newData = json.data;
	      		 if(newData=="" && $(".userInput").val()!=""){
	      			$(".userInput").val("");
	      			layer.alert("没有这个用户请重新输入");
	      		 }	
	      		  for(i=0;i<newData.length;i++){
	      			 var item=newData[i];
	      			 if(item.gamePlayer==0){
	      				item.gamePlayer="玩家";
	      			 }
	      			 if(item.gamePlayer==1){
	      				item.gamePlayer="代理";
	      			 }
	      			if(item.gamePlayer==null){
	      				item.gamePlayer="";
	      			}
	      			item.odds=(item.odds*100).toFixed(1)+"%";
	      			 item.balance+="元";
	      		 }  
	      		 return newData;
	      	 }
	       },	
	        "columns": [
				           { "data": "name","className":" name-td"},
				           { "data": "gamePlayer","className":" gamePlayer-td"},
				           { "data": "odds","className":" odds-td"},
				           { "data": "balance","className":" balance-td"},
				           { "data": "registerTime","className":" registerTime-td"},
				           { "data": "lastTime","className":" lastTime-td"},
				           { "data": null, "defaultContent": "<button class='btn btn-default'>查看下级</button>"},
	               ]        
	 	});	
	}
	datatable01();	
	
	/* 点击搜索 */
	$(".submitBtn").on("click",function(){
		if($(".userInput").val()==""){
			return;
		}
		/* datatable.destroy(); */
		datatable.destroy();
		datatable01();
	});
	
	/* 点击重置 */
	$(".searchPart .reset").on("click",function(){
		$(".searchPart span").text("我的下级");
		$(".searchPart input").val("");
		userName="";
		datatable.destroy();
		datatable01();
	});
	
	/* 点击查看下级 */
	$("#subUser").on("click",".btn-default",function(){
		userName=$(this).parents("tr").find(".name-td").text();
		$(".searchPart span").text(userName+"的下级");
		datatable.destroy();
		datatable01();
	});
</script>
